<div class="content-section introduction " >
  <div>
    <span class="feature-title">报表报告 | <small>发送配置</small> </span>
  </div>
</div>

<div class="content-section implementation GridDemo">
  <div class="mysearch">
    <div class="ui-grid ui-grid-responsive ui-grid-pad ui-fluid">
      <div class="ui-grid-row">
        <div>
          <button pButton type="button"  label="新增" (click)="showConfigEdit()"></button>
        </div>
      </div>
    </div>
  </div>

  <p-dataTable [value]="configs" [responsive]="true"  >
    <p-column [style]="{'width':'30px'}" selectionMode="multiple" ></p-column>
    <!--<p-column field="color" header="序号" [sortable]="true">-->
    <p-column field="name" header="名称" [sortable]="true"></p-column>
    <p-column field="types" header="周期类型" [sortable]="true">
      <ng-template let-col let-car="rowData" pTemplate="body">
        {{car[col.field][0] == "day" ? "日报" : (car[col.field][0] == "week" ? "周报" : (car[col.field][0] == "month" ? "月报" : car[col.field][0] == "year" ? "年报" : car[col.field][0]))}}
      </ng-template>
    </p-column>
    <p-column field="way" header="生成方式" [sortable]="true">
      <ng-template let-col let-car="rowData" pTemplate="body">
        {{car[col.field] == "auto" ? "自动" : (car[col.field] == "manual" ? "手动" : car[col.field])}}
      </ng-template>
    </p-column>
    <p-column field="time" header="创建时间" [sortable]="true"></p-column>
    <p-column field="time_send" header="发送时间" [sortable]="true"></p-column>
    <!--<p-column field="send_time" header="发送时间" [sortable]="true"></p-column>
    <p-column field="week_send_time" header="发送时间（周）" [sortable]="true"></p-column>-->
    <p-column field="send_way" header="发送方式" [sortable]="true"></p-column>
    <p-column field="receiver" header="接收人" [sortable]="true"></p-column>
    <p-column field="enable" header="状态" [sortable]="true">
      <ng-template let-col let-car="rowData" pTemplate="body">
        {{car[col.field] ? "启用" : "不启用"}}
      </ng-template>
    </p-column>
    <p-column field="" header="操作" [style]="{'width':'12vw'}">
      <ng-template let-data="rowData" pTemplate="operator">
        <button pButton type="button"  (click)="showConfigEdit(data)" label="编辑"  ></button>
        <button pButton type="button"  (click)="enableConfig(data,true)" label="启用" *ngIf="!data.enable"></button>
        <button pButton type="button"  (click)="enableConfig(data,false)" label="不启用" *ngIf="data.enable"></button>
        <button pButton type="button"  (click)="showConDelete(data)" label="删除"  ></button>
      </ng-template>
    </p-column>
    <ng-template pTemplate="emptymessage">
      当前没有数据
    </ng-template>
  </p-dataTable>
  <p-paginator rows="10" totalRecords="{{total}}" [rowsPerPageOptions]="[10,20,30]" pageLinkSize="{{page_total}}"  (onPageChange)="paginate($event)"></p-paginator>
  <!--<p-growl [(value)]="msgs"></p-growl>-->
  <!--<p-growl [(value)]="deletemsgs"></p-growl>-->

  <p-growl [(value)]="msgPop"></p-growl>
</div>

<!-- 编辑发送配置弹框 -->
<!--<app-templet-edit [currentTem]="selectedCol" [state]="temState" (closeTempletEdit)="closeTempletEdit($event)" (addTem)="addTemNode($event)" (updateTem)="updateTemNode($event)"  *ngIf="showTempletEditMask"></app-templet-edit>-->
<app-send-config [currentCon]="selectedCol" [state]="conState" (closeConfigEdit)="closeConfigEdit($event)" (addCon)="addConNode($event)" (updateCon)="updateConNode($event)"  *ngIf="showConfigEditMask"></app-send-config>

<!-- 删除发送配置弹框 -->
<p-growl [(value)]="deletemsgs"></p-growl>
<p-dialog header="删除确认框" [(visible)]="showConDeleteMask" modal="modal" width="300" [responsive]="true">
  <p>{{deleteConTip}}</p>
  <p-footer>
    <button type="button" pButton icon="fa-check" (click)="deleteCon()" label="确定"></button>
    <button type="button" pButton icon="fa-close" (click)="showConDeleteMask=false" label="取消"></button>
  </p-footer>
</p-dialog>


